//
//  HotBoardTableViewCell.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/9.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "HotBoardTableViewCell.h"


@interface HotBoardTableViewCell ()

@property (nonatomic, strong) UIImageView *headImage;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *detailLabel;
@property (nonatomic, strong) UILabel *moneyLabel;

@end

@implementation HotBoardTableViewCell

+ (HotBoardTableViewCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"HotBoardTableViewCell";
    HotBoardTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[HotBoardTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    
    return cell;
}

- (void)createSubView {
    UIView *headBg = [[UIView alloc] initWithFrame:CGRectMake(ScreenX375(13), 0, SCREEN_WIDTH - ScreenX375(26), ScreenX375(85))];
    headBg.layer.borderColor = REXADECIMALCOLOR(@"#dcdcdc").CGColor;
    headBg.layer.borderWidth = 0.8;
    headBg.layer.cornerRadius = ScreenX375(2);
    headBg.clipsToBounds = YES;
    [self addSubview:headBg];
    self.headImage = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(13), 0, ScreenX375(80), ScreenX375(85))];
    [self addSubview:self.headImage];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(104), ScreenX375(10), ScreenX375(230), ScreenX375(18))];
    self.nameLabel.textColor = REXADECIMALCOLOR(@"#333333");
    self.nameLabel.font = Kfont(14);
    [self addSubview:self.nameLabel];
    
    self.detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(104), ScreenX375(32), ScreenX375(230), ScreenX375(14))];
    self.detailLabel.textColor = REXADECIMALCOLOR(@"#999999");
    self.detailLabel.font = Kfont(12);
    self.detailLabel.text = @"成交224笔 | 服务评分：4.98分";
    [self addSubview:self.detailLabel];

    self.moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - ScreenX375(118), ScreenX375(60), ScreenX375(100), ScreenX375(18))];
    self.moneyLabel.textColor = ThemeColor;
    self.moneyLabel.font = Kfont(14);
    self.moneyLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.moneyLabel];
}

- (void)initWithModel:(HotBoardModel *)model {
    [self.headImage sd_setImageWithURL:[NSURL URLWithString:model.index_pic] placeholderImage:nil options:SDWebImageRetryFailed];
    self.nameLabel.text = model.card_name;
    self.moneyLabel.text = [NSString stringWithFormat:@"￥%@",model.price];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end

@implementation HotBoardModel


@end
